import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:banquanjie_app/app/services/screenAdapter.dart';
class HomeTitle extends StatelessWidget {
  final String title;
  final Function()? onTap;
  const HomeTitle(this.title, {super.key, this.onTap});
  @override
  Widget build(BuildContext context) {
    return  Padding(
      // 38rpx 26rpx 9rpx 20rpx
      padding: EdgeInsets.fromLTRB(ScreenAdapter.width(20), ScreenAdapter.width(38), ScreenAdapter.width(26), ScreenAdapter.width(8)),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Stack(
            children: [
              Positioned(
                bottom: 0,
                left: 0,
                child: Container(
                  width: ScreenAdapter.width(76),
                  height: ScreenAdapter.width(8),
                  decoration: BoxDecoration(
                    gradient: LinearGradient(
                      begin: Alignment.centerLeft,
                      end: Alignment.centerRight,
                      colors: [
                        Color(0xff00B277),
                        Color(0xffC0E8E0)
                      ]
                    )
                  ),
                  child: Text('')
                )
              ),
              Text(title, style: TextStyle(height: 1, fontSize: ScreenAdapter.fontSize(30), fontWeight: FontWeight.bold)),
            ]
          ),
          RichText(
            text: TextSpan(
              children: [
                TextSpan(
                  text: '查看更多', 
                  style: TextStyle(
                    height: 1, 
                    color: Color(0xFF999999), 
                    fontSize: ScreenAdapter.fontSize(24)
                  ),
                  recognizer: TapGestureRecognizer()..onTap = onTap
                ),
                WidgetSpan(
                  child: Icon(Icons.navigate_next, size: ScreenAdapter.width(30), color: Color(0xFF999999)),
                  
                )
              ]
            )
          )
        ]
      )
    );
  }
}